package com.mjlf.spring;

import com.mjlf.spring.config.ApplicationConfig;
import com.mjlf.spring.entity.TestScope;
import com.mjlf.spring.entity.TestScope1;
import com.mjlf.spring.scope.MyScope;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @ClassName TestJavaConfig
 * @auther mjlf
 * @Date 2019/6/27 11:30
 * @Description TODO
 */
public class TestJavaConfig {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(ApplicationConfig.class);
        annotationConfigApplicationContext.getBeanFactory().registerScope("myScope", new MyScope());

        System.out.println(annotationConfigApplicationContext.getBean(TestScope.class));
        System.out.println(annotationConfigApplicationContext.getBean(TestScope1.class));
    }
}
